package com.senlingspace.system.service.impl;

import com.senlingspace.common.annotation.DataScope;
import com.senlingspace.common.utils.DateUtils;
import com.senlingspace.common.utils.NumberGenerator;
import com.senlingspace.common.utils.PageUtils;
import com.senlingspace.common.utils.SecurityUtils;
import com.senlingspace.system.domain.SlkjInvestor;
import com.senlingspace.system.mapper.SlkjInvestorMapper;
import com.senlingspace.system.service.ISlkjInvestorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 投资方Service业务层处理
 * 
 * @author SenlingSpace
 * @date 2024-06-26
 */
@Service
public class SlkjInvestorServiceImpl implements ISlkjInvestorService 
{
    @Autowired
    private SlkjInvestorMapper slkjInvestorMapper;

    /**
     * 查询投资方
     * 
     * @param investorId 投资方主键
     * @return 投资方
     */
    @Override
    public SlkjInvestor selectSlkjInvestorByInvestorId(Long investorId)
    {
        return slkjInvestorMapper.selectSlkjInvestorByInvestorId(investorId);
    }

    /**
     * 查询投资方列表
     * 
     * @param slkjInvestor 投资方
     * @return 投资方
     */
    @Override
    public List<SlkjInvestor> selectSlkjInvestorList(SlkjInvestor slkjInvestor) {
        PageUtils.startPage();
        return slkjInvestorMapper.selectSlkjInvestorList(slkjInvestor);
    }

    /**
     * 新增投资方
     * 
     * @param slkjInvestor 投资方
     * @return 结果
     */
    @Override
    public int insertSlkjInvestor(SlkjInvestor slkjInvestor)
    {
        slkjInvestor.setCreateTime(DateUtils.getNowDate());
        slkjInvestor.setInvestorNo(NumberGenerator.getCharacters());
        slkjInvestor.setUserId(SecurityUtils.getUserId());
        slkjInvestor.setDeptId(SecurityUtils.getDeptId());
        return slkjInvestorMapper.insertSlkjInvestor(slkjInvestor);
    }

    /**
     * 修改投资方
     * 
     * @param slkjInvestor 投资方
     * @return 结果
     */
    @Override
    public int updateSlkjInvestor(SlkjInvestor slkjInvestor)
    {
        slkjInvestor.setUpdateTime(DateUtils.getNowDate());
        return slkjInvestorMapper.updateSlkjInvestor(slkjInvestor);
    }

    /**
     * 批量删除投资方
     * 
     * @param investorIds 需要删除的投资方主键
     * @return 结果
     */
    @Override
    public int deleteSlkjInvestorByInvestorIds(Long[] investorIds)
    {
        return slkjInvestorMapper.deleteSlkjInvestorByInvestorIds(investorIds);
    }

    /**
     * 删除投资方信息
     * 
     * @param investorId 投资方主键
     * @return 结果
     */
    @Override
    public int deleteSlkjInvestorByInvestorId(Long investorId)
    {
        return slkjInvestorMapper.deleteSlkjInvestorByInvestorId(investorId);
    }
}
